package net.wanho.systemSettings.service.impl;

import net.wanho.commons.exception.DAOException;
import net.wanho.commons.exception.ServiceException;
import net.wanho.commons.service.BaseService;
import net.wanho.commons.service.impl.BaseServiceImpl;
import net.wanho.systemSettings.dao.PositionDAO;
import net.wanho.systemSettings.po.Position;
import net.wanho.systemSettings.service.PositionService;

public class PositionServiceImpl extends BaseServiceImpl<PositionDAO, Position> implements PositionService {
    @Override
    public long count(String positionName) throws ServiceException {
        return super.baseDAO.count(positionName);
    }

    @Override
    public long countPositionIdRef(String positionId) throws ServiceException {
        return super.baseDAO.countPositionIdRef(positionId);
    }

    @Override
    public boolean modifyPositionIdRef(Position position) throws ServiceException {
        //1. 先删除关联职位的id  关系表
        super.baseDAO.deletePositionIdRef(position.getPositionId()+"") ;
        //2. 批量插入
        super.baseDAO.insertPositionIdRef(position) ;
        return true;
    }
}
